import request from "@/utils/request";

// 获取商品最新信息
export const getNewCartGoods = (skuId) =>
  request(`/goods/stock/${skuId}`, "get");

// 合并购物车
export const mergeCart = (cartList) =>
  request("/member/cart/merge", "post", cartList);

// 获取购物车
export const getCartList = () => request("/member/cart", "get");

// 加入购物车
export const insertCart = ({ skuId, count }) =>
  request("/member/cart", "post", { skuId, count });

// 删除购物车商品（支持批量）
export const deleteCart = (ids) => request("/member/cart", "delete", { ids });

// 修改购物车商品
export const updateCart = (data) =>
  request(`/member/cart/${data.skuId}`, "put", data);

// 全选&反选
export const checkAllCart = ({ selected, ids }) =>
  request("/member/cart/selected", "put", { selected, ids });
